<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>系统行为日志</title>
	<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
	<link rel="stylesheet" th:href="@{/static/lib/layui/css/layui.css}">
	<link rel="stylesheet" th:href="@{/static/css/nicer.css}" media="all">
</head>
<body>
<div class="layui-row">
	<table id="sys_log" lay-filter="sys_log"></table>
</div>
<script th:src="@{/static/lib/layui/layui.js}"></script>
<script th:inline="javascript">
	const ctx = /*[[ @{/} ]]*/ "";
    layui.use('table', function () {
        const table = layui.table;

        //第一个实例
        table.render({
            elem: '#sys_log'
            , url: ctx + 'syslog/list' //数据接口
			, method: "POST"
            , page: true //开启分页
            , limit: 10
            , limits: [10, 15, 30, 50, 100, 300]
            , cols: [ [ //表头
                {type: 'numbers', title: 'ID', width: 80, sort: true, align: "center"}
                , {field: 'userId', title: '操作用户', width: 100, align: "center", templet: function (d) {
                    return d.user.username;
					}}
                , {field: "requestTime", title: "请求时间", width: 180, align: "center"}
                , {field: "ip", title: "请求IP", width: 120, align: "center"}
                , {field: "requestUrl", title: "请求路由", width: 250}
                , {field: "requestWay", title: "请求方式", width: 90, align: "center"}
                , {field: 'message', title: '操作', width: 200, sort: true, align: "center"}
                , {field: 'operation', title: '日志类型', width: 120, align: "center"}
                , {field: 'method', title: '请求方法', width: 400}
				, {field: "params", title: "请求参数", width: 200}
				, {field: "totalTime", title: "耗时", width: 150, align: "center", templet: function (d) {
						return `${d.totalTime}毫秒`;
                    }}
            ] ]
        });
    });
</script>
</body>
</html>